package cn.exrick.xboot.base.coroutines

import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

fun main() {

    val job = runBlocking {

        launch {

            var i = 1
            while (true) {

                print("$i little sleep")
                ++i
                delay(500L)
            }
        }
    }

    Thread.sleep(1000L)
    job.cancel()
    Thread.sleep(1000L)
    print("main process finished!!")
}